﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SiteServer.Plugin;
using Thingpower.SS.EduOnline.Provider;
using Thingpower.SS.EduOnline.Model;

namespace Thingpower.SS.EduOnline.BackgroundPages
{
    public partial class PageDashboard : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EduOnlinePlugin.Instance.AdminApi.HasSystemPermissions())
            {
                HttpContext.Current.Response.Write("<h1>未授权访问</h1>");
                HttpContext.Current.Response.End();
                return;
            }

            this.litUserCount.Text = UserDAO.GetCount("1 = 1").ToString();
            this.litCoursewareCount.Text = CoursewareDAO.GetCount("ChannelId > 0").ToString();
            this.litStudyCount.Text = StudyLogDAO.GetCount("1 = 1").ToString();
        }
    }
}